﻿<%@ Control Language="C#" AutoEventWireup="true" Inherits="Portal.Data.Webparts.WebpartControl" %>
<%@ Import Namespace="Portal.Data.Config" %>
<%@ Import Namespace="Portal.Data.Entity" %>
<%@ Import Namespace="Portal.Data.Webparts" %>
<%if (Slide.Items.Count > 0)
  { %>
<script type="text/javascript">
	var dw=getViewport();
	var scrollitems= 3;
	if(dw[0]<640)
		scrollitems= 1;
	else if(dw[0]<768)
		scrollitems= 2;
		
	jQuery(function () { $("#carousel").jCarouselLite({ btnNext: ".new_arr_right", btnPrev: ".new_arr_left", auto: false, scroll: scrollitems }); }); 	
</script>

<div class="moi_nhat clear_fix">
    <div class="wrap_content clear_fix">
        <span class="tit_cate">
            <%= Config.DisplayTitle %>
        </span>

        <div class="truyen_moi">
            <a href="#" class="new_arr_left"></a>
            <a href="#" class="new_arr_right"></a>
            <div id="carousel">
                <ul>
                    <asp:Repeater ID="Slide" runat="server">
                        <ItemTemplate>
                            <li rel="popover" data-content="<%#Eval("QuickInfo")%>" data-original-title="<%#Eval("FullName")%> [<%#Eval("LastChapTitle")%>]">
                                <div class="new_thumb" title="<%#Eval("FullName")%> [update <%#Eval("LastChapTitle")%>]">
                                    <a href="<%#Eval("Url")%>">
                                        <div class="thumb w260" style="background: url('<%#Book.RenderImage((string)Eval("Image"), 260)%> ')">
                                        </div>
                                    </a>
                                    <div class="tag_truyen <%#Eval("CssFull") %>"></div>
                                </div>
                                <a href="<%#Eval("Url")%>" class="new_tit">
                                    <%#Eval("FullName")%>
                                </a>
                                <p onclick="location.href='<%#Eval("LastChapUrl")%>'" style="cursor: pointer">
                                    Update <%#Eval("LastChapTitle")%>
                                </p>
                                <div class="new_view">
                                    <span class="sl_view"><%#Eval("TotalVisit") %></span>
                                    <span class="hot_date"><%#Portal.Core.Common.FriendlyDateDisplay(Eval("ModifiedDate")) %></span>
                                </div>
                            </li>
                        </ItemTemplate>
                    </asp:Repeater>
                </ul>
            </div>
            <img src="https://lh5.googleusercontent.com/-igrp_TvQVi4/U-3SPlkhCpI/AAAAAAAAAP8/N_s3oWUsDok/s131/ic_frog.png" class="ic_frog"/>
        </div>
        <!--END truyen_moi-->
    </div>
    <!--END wrap_content-->
</div>
<!--END moi_nhat-->
<% }
  else
  { %>
<span class="tit_dangoc"><%=Config.DisplayTitle %></span>
<ul class="list_dangdoc">
    <asp:Repeater ID="NotSlide" runat="server">
        <ItemTemplate>
            <li rel="popover" data-content="<%#Eval("QuickInfo")%>" data-original-title="<%#Eval("FullName")%> [<%#Eval("LastChapTitle")%>]">
                <a href="<%#Eval("Url")%>" class="hot_thumb">
                    <div class="thumb w143 shadow" style="background: url('<%#Book.RenderImage((string)Eval("Image"), 143)%> ')"></div>
                    <div class="tag_truyen <%#Eval("CssFull") %>"></div>
                </a>
                <a href="<%#Eval("Url")%>" class="hot_tit"><%#Eval("FullName")%></a>
                <div class="hot_view">
                    <span class="sl_view"><%#Eval("TotalVisit") %></span>
                    <span class="hot_date"><%#Portal.Core.Common.FriendlyDateDisplay(Eval("ModifiedDate")) %></span>
                </div>
            </li>
        </ItemTemplate>
    </asp:Repeater>
</ul>

<br class="clear" />
<asp:PlaceHolder runat="server" ID="phPagingBottom"></asp:PlaceHolder>
<br class="clear" />
<br class="clear" />

<div id="fb-block">
    <div class="fb-comments" data-href="http://comic.truyengicungco.com" data-width="650" data-num-posts="5"></div>
</div>
<% } %>

<script runat="server">
    public override WebpartConfig NewConfig
    {
        get { return new CustomPagingConfig(); }
    }

    public CustomPagingConfig PartConfig
    {
        get { return (CustomPagingConfig)Config; }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!PartConfig.AllowPaging)
        {
            Slide.DataSource = Book.FindLatestUpdate(0);
            Slide.DataBind();
        }
        else
        {
            var pageindex = Common.GetCurrentPageIndex();
            var books = Book.FindLatestUpdate(pageindex);
            NotSlide.DataSource = books;
            NotSlide.DataBind();
            Common.PagingWithouTotalCount(new Control[] {phPagingBottom }, pageindex, books.Count);
        }
    }        

</script>
